package com.situ;

import static org.junit.Assert.*;

import java.beans.Transient;
import java.util.Scanner;
import java.util.concurrent.atomic.AtomicReferenceArray;

import javax.print.attribute.SetOfIntegerSyntax;

import org.junit.Test;

public class lianxi720 {
	@Test
	public void test(){
		Scanner scanner = new Scanner(System.in);
		System.out.println("请输入月份");
		int month = scanner.nextInt();
		if(month < 0||month > 12){
			System.out.println("输入非法");
			return;
		}
		switch(month){
		case 1:
		case 3:
		case 5:
		case 7:
		case 8:
		case 10:
		case 12:
			System.out.println("31天");
			break;
		case 4:
		case 6:
		case 9:
		case 11:
		System.out.println("30天");
		break;
		case 2:
			
		System.out.println("28");
		break;
		default:
			System.out.println("输入的非法");
			break;
		}
	}
	@Test//成绩
	public void  test1() {
		Scanner scanner = new Scanner(System.in);
		System.out.println("请输入成绩");
		int score = scanner.nextInt();
		if(score < 0||score > 100){
			System.out.println("输入的成绩非法");
			return;
		}
		switch(score / 10){
		case 6:
			System.out.println("及格");
			break;
		case 7:
			System.out.println("一般");
			break;
		case 8:
			System.out.println("良好");
			break;
		case 9:
		case 10:
			System.out.println("优秀");
			break;
			default:
				System.out.println("不及格");
				break;
		}
	}
	@Test//循环查询成绩
	public void test3(){
		for(; ;){
			Scanner scanner = new Scanner(System.in);//while （i！=0）
			System.out.println("请输入成绩");
			int chengji = scanner.nextInt();
			if (chengji >= 60 && chengji < 70) {
				System.out.println("及格");
			}else if(chengji >= 70 && chengji < 80){
				System.out.println("一般");
			}else if(chengji >= 80 && chengji < 90){
				System.out.println("良好");
			}else if(chengji >= 90 && chengji <100){
				System.out.println("优秀");
			}else if(chengji == 0){                                //i = 0
				return;
			}else {
				System.out.println("不及格");
				//
			}
			System.out.println("是否退出，退出按0");
		}  
	}
	@Test//数组逆显示
	public void test4(){
		int[] array = new int[3];
		array[0] = 4;                //0开始
		array[1] = 5;
		array[2] = 8;
		for(int i=2;i>=0;i--){
			System.out.println(array[i]);
		}
	}
	@Test//数据调用
	public void test6(){
		int[] array= new int[3];
		array[0] = 12;
		array[1] = 2;
		array[2] = 3;
		int result = ji(array);
		System.out.println(result);
	}
	public int ji(int[] array){
		int ji = 1;
		for(int i = 0;i < array.length;i++){
			ji = ji * array[i];
		}
		System.out.println(ji);
		return ji;
	}
	@Test
	public void test7(){
		for(int i = 100;i <= 200;i++){
			boolean sushu = true;
			for(int j = 2;j < i;j++){
				if(i % j == 0){          //取余等于零，能被其他数整除，进来
					sushu = false;       //100%2   余为0
					break;
					
				}
			}
			if(sushu == true){
				System.out.println(i);
			}
		}
	}
	@Test
	public void test8(){
		int[] array =  new int[3];
		array[0] = 3;
		array[1] = 9;
		array[2] = 6;
		int shuchu = ji(array);						//sum 运算的名字（数组的名）
		System.out.println(shuchu);
	}
	public int sum(int[]array){						//sum（完整的数组名）
		int ji = 1;
		for (int i = 0; i < array.length; i++) {
			ji = ji * array[i];						//通过循环的array的值
			}
		return ji;										//返回到运算的名字
		}
		
	}
	

	

